#include<stdio.h>

int GetBirthDate(char id[])
{
	int number[8],p=1e7,k=6,n;
	for (int i=0;i<8;i++) {
		number[i]=id[k++]-'0';
		n+=number[i]*p;
		p/=10; 
	}
	return n;
}

int main()
{
	char id[]="51010219990506001X";
	int date=0,year,month,day; 
	date=GetBirthDate(id); 
	year=date/10000; 
	month=date/100%100; 
	day=date%100;
	printf("%04d-%02d-%02d\n",year,month,day);
	return 0; 
}
